from piece import PlayerPiece

class Team:
    """ Represents a group of players """
    
    (UP, DOWN) = range(100,102)
    
    def __init__(self, orientation=None, name=None):
        self.orientation = orientation
        self.name = name
        self.players = []
        self.score = 0
        
    def add_player(self, player):
        self.players.append(player)
        player.orientation = self.orientation
        
    def get_keeper(self):
        for player in self.players:
            if player.id == PlayerPiece.G:
                return player
        
    def __len__(self):
        return len(self.players)